﻿/**
 * @file   FITKAbaqusAdaptorSection.h
 * @brief Abaqus Part 适配器 用于读取INP过程中的Part里的section解析
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date 2024-03-22
 */
#ifndef __FITKABAQUSADAPTORSECTION__H__
#define __FITKABAQUSADAPTORSECTION__H__

#include "FITKAbaqusAbstractAdaptor.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"

ForwardDeclarNS(AbaqusData, FITKAbaqusPart)
ForwardDeclarNS(Interface, FITKAbaAbastractSection)
ForwardDeclarNS(Interface, FITKAbaSectionBeam)
ForwardDeclarNS(Interface, FITKAbaSectionShellHomogeneous)
ForwardDeclarNS(Interface, FITKAbaSectionSolidHomogeneous)
ForwardDeclarNS(Interface, FITKMaterialManager)
ForwardDeclarNS(Interface, FITKSectionAssign)
ForwardDeclarNS(Interface, FITKComponentManager)
ForwardDeclarNS(Interface, FITKAbaProfile)
ForwardDeclarNS(Interface, FITKAbaMaterialOrientationManager)
ForwardDeclarNS(Interface, FITKCoordinateSystemManager)
ForwardDeclarNS(Interface, FITKAbstractModel)

namespace IO
{
    /**
     * @brief section读写适配器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date 2024-04-07
     */
    class FITKAbaqusIOINPAPI FITKAbaqusAdaptorSection : public FITKAbaqusAbstractAdaptor
    {
    public:
        explicit FITKAbaqusAdaptorSection() = default;
        ~FITKAbaqusAdaptorSection() = default;

        /**
         * @brief 获取适配器数据类型名
         * @return 适配器数据类型名
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        QString getAdaptorClass() override;

        /**
         * @brief 适配器读取
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool adaptR() override;

        /**
         * @brief 设置Part
         * @param modelData 模型数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-02
         */
        void setModel(Interface::FITKAbstractModel* modelData);

        /**
         * @brief 适配器写出
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool adaptW() override;

        /**
         * @brief 设置指派器和梁剖面
         * @param assign 指派器
         * @param profile 梁剖面
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-25
         */
        void setSectionAssignAndProfile(Interface::FITKSectionAssign* assign, Interface::FITKAbaProfile* profile);

    private:
        /**
         * @brief 读取梁截面属性
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool beamSectionR();

        /**
         * @brief 读取I型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-09
         */
        bool beamSectionProfileIR();

        /**
         * @brief 读取L型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfileLR();

        /**
         * @brief 读取Box型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfileBoxR();

        /**
         * @brief 读取Pipe型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfilePipeR();

        /**
         * @brief 读取Circular型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfileCircularR();

        /**
         * @brief 读取Rectangular型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfileRectangularR();

        /**
         * @brief 读取均匀壳截面属性
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool shellHomogeneousSectionR();

        /**
         * @brief 读取均匀实体截面属性
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool solidHomogeneousSectionR();

        /**
         * @brief 创建材料坐标系
         * @param line 行数据
         * @param setId 集合id
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-07
         */
        bool materialOrientationR(QString line, int setId);

        /**
         * @brief 设置截面的材料属性
         * @param materialName 材料名称
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-24
         */
        bool setSectionMaterial(QString materialName);

        /**
         * @brief 写出梁截面属性
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool beamSectionW();

        /**
         * @brief 写出I型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-09
         */
        bool beamSectionProfileIW();

        /**
         * @brief 写出L型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfileLW();

        /**
         * @brief 写出Box型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfileBoxW();

        /**
         * @brief 写出Pipe型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfilePipeW();

        /**
         * @brief 写出Circular型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfileCircularW();

        /**
         * @brief 写出Rectangular型梁的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-02
         */
        bool beamSectionProfileRectangularW();

        /**
         * @brief 写出均匀壳截面属性
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool shellHomogeneousSectionW();

        /**
         * @brief 写出均匀实体截面属性
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-23
         */
        bool solidHomogeneousSectionW();

        /**
         * @brief 通过名称获取模型id
         * @param setName 模型名称
         * @param type 类型
         * @return 模型id
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-24
         */
        int getSetIDByName(QString setName, int type);
        /**
         * @brief 写出Orientation关键字
         * @param setId 集合id
         * @param isStack 是否写出堆叠方向
         * @return 写出的数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-07
         */
        QString materialOrientationW(int setId, bool isStack);

    private:
        /**
         * @brief 模型-part
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-21
         */
        Interface::FITKAbstractModel* _modelData{};

        /**
         * @brief 指派器
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-03-25
         */
        Interface::FITKSectionAssign* _assign{};

        /**
         * @brief 剖面
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-08
         */
        Interface::FITKAbaProfile* _profile{};
    };
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaSectionBeam, FITKAbaqusAdaptorSection, 1)
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaSectionShellHomogeneous, FITKAbaqusAdaptorSection, 2)
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaSectionSolidHomogeneous, FITKAbaqusAdaptorSection, 3)
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaAbastractSection, FITKAbaqusAdaptorSection, 4)
}

#endif
